package com.arvin.faceDetect.ui

import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import com.arvin.faceDetect.R
import com.arvin.faceDetect.databinding.FragmentMyBinding

class MyFragment : Fragment() {
    private var _binding: FragmentMyBinding? = null
    private val binding get() = _binding!!

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        _binding = FragmentMyBinding.inflate(inflater, container, false)
        return binding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        setupNavigationButtons()
    }

    private fun setupNavigationButtons() {
        // 设置人脸管理入口点击事件
        binding.btnFaceManagement.setOnClickListener {
            startActivity(Intent(requireContext(), FaceManagementActivity::class.java))
        }

        // 设置采集设置入口点击事件
        binding.btnCollectionSettings.setOnClickListener {
            findNavController().navigate(R.id.action_global_to_collectionSettings)
        }

        // 设置识别设置入口点击事件
        binding.btnRecognitionSettings.setOnClickListener {
            findNavController().navigate(R.id.action_navigation_my_to_recognitionSettingsFragment)
        }

        // 设置相机设置入口点击事件
        binding.btnCameraSettings.setOnClickListener {
            findNavController().navigate(R.id.action_navigation_my_to_cameraSettingsFragment)
        }

        // 设置系统设置入口点击事件
        binding.btnSystemSettings.setOnClickListener {
            findNavController().navigate(R.id.action_navigation_my_to_systemSettingsFragment)
        }
    }

    override fun onDestroyView() {
        super.onDestroyView()
        _binding = null
    }
} 